
<section id="content" class="grid_7 alpha omega">
<article>
<h1>Ubah Password</h1>
<div class="success" style="display:none">Success</div>
<div class="error" style="display:none">Error</div>
<form id="form" action="<?php echo base_url()."member/password"?>" class="styled" method="post" enctype="multipart/form-data" >	
		
		<div class="grid_4 left">
			<label for="name">Password Lama</label>
			<input class="textbox validate[required]" type="password"  id="password_lama" name="password_lama" />
			
			<label for="name">Password Baru</label>
			<input class="textbox validate[required]" type="password"  id="password_baru" name="password_baru" />
			
			<label for="name">Konfirmasi</label>
			<input class="textbox validate[required,equals[password_baru]]" type="password"  id="konfirmasi" />
			
			<input type="submit" value="SIMPAN" class="right button" />
			
		</div>
</form>
</article>
</section>

<script>				
$(document).ready(function(){

	$("#form").validationEngine();
	
});
$("#form").submit(function(){
	if($(this).validationEngine('validate')){
		var formInput = $(this).serialize();
		
		$.ajax({
			url: $(this).attr('action'),
			data: formInput,
			beforeSend : function(){
				$.fancybox.showActivity();
				$(".error").hide();
			},
			success: function(respon){
				var obj = jQuery.parseJSON(respon);
				if(obj.status == 'success'){
					$(".error").hide();
					$(".success").text(obj.msg);
					$(".success").fadeIn(1000);
				}else{
					$(".success").hide();
					$(".error").text("Password gagal disimpan...");
					$(".error").fadeIn(1000);
				}
				
				$.fancybox.hideActivity();
			},
			type: "POST"
		});
	}
	return false;
});
</script>